//
//  FirstDetailTableViewCell.m
//  LANGirl
//
//  Created by 杨泓晔 on 16/3/7.
//  Copyright © 2016年 LanJue. All rights reserved.
//

#import "FirstDetailTableViewCell.h"

@interface FirstDetailTableViewCell ()
@property (nonatomic,retain)UIImageView *myBackimageView;/**<背景白版*/
@property (nonatomic,retain)UILabel *nameL;
@property (nonatomic,retain)UIImageView *priceImageView;
@property (nonatomic,retain)UILabel *priceL;
@property (nonatomic,retain)UIImageView *sexImageView;
@property (nonatomic,retain)UILabel *sexL;
@property (nonatomic,retain)UIImageView *workIM;
@property (nonatomic,retain)UILabel *workL;
@property (nonatomic,retain)UILabel *peopleL;
@property (nonatomic,retain)UILabel *ageL;
@end


@implementation FirstDetailTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
        
        
    }
    return self;
}
- (void)createView{
    
    
    self.backgroundColor = LV;
    
    
    
    self.myBackimageView = [UIImageView new];
    [self.contentView addSubview:self.myBackimageView];
    self.myBackimageView.backgroundColor = [UIColor whiteColor];
    //裁掉边框
    self.myBackimageView.layer.masksToBounds = YES;
    //设置半径
    self.myBackimageView.layer.cornerRadius = 6 *AUTO_HEIGHT;
    [self.myBackimageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top).offset(5);
        make.left.mas_equalTo(self.contentView.mas_left).offset(14);
        make.bottom.mas_equalTo(self.mas_bottom).offset(-5);
        make.width.mas_equalTo(SCREEN_WIDTH - 14 * 2);
    }];
    self.myBackimageView.layer.borderWidth=1.0;
    //边框颜色
    self.myBackimageView.layer.borderColor=[[UIColor colorWithRed:0.819 green:0.808 blue:0.789 alpha:0.530]CGColor];
    
    
    
    //    name
    self.nameL = [UILabel new];
    self.nameL.backgroundColor = [UIColor cyanColor];
    [self.myBackimageView addSubview:self.nameL];
    self.nameL.alpha = 0.74;
    self.nameL.font = [UIFont systemFontOfSize:16 *AUTO_HEIGHT];
    [self.nameL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(200 * AUTO_WIDTH, 30 * AUTO_HEIGHT));
        make.top.mas_equalTo(self.myBackimageView.mas_top).offset(12 * AUTO_HEIGHT);
        make.left.mas_equalTo(self.myBackimageView).offset(18 * AUTO_WIDTH/2);
        
    }];
    
    
    
    //价钱图片
    self.priceImageView = [UIImageView new];
    [self.myBackimageView addSubview:self.priceImageView];
    [self.priceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_HEIGHT));
        make.top.mas_equalTo(self.myBackimageView).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(self.nameL.mas_right).offset(30 * AUTO_WIDTH);
        
    }];
    self.priceImageView.image = [UIImage imageNamed:@"qiang2p.png"];

        
    
    
    //价钱
    self.priceL = [UILabel new];
    self.priceL.backgroundColor = [UIColor redColor];
    [self.myBackimageView addSubview:self.priceL];
    [self.priceL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.priceImageView);
        make.left.mas_equalTo(self.priceImageView.mas_right).offset(3);
        make.size.mas_equalTo(CGSizeMake(100, 15));
        
    }];
    self.priceL.text = @"12222/yuan";
    
    
    
    
    
    UIImageView *timeIm = [[UIImageView alloc]init];
    timeIm.image = [UIImage imageNamed:@"shijian3p-01-01.png"];
    [self.myBackimageView addSubview:timeIm];
    [timeIm mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameL.mas_bottom).offset(13.00*HEIGHT/2);
        make.left.equalTo(self.myBackimageView).offset(20.00*WEIGHT/2);
        make.size.mas_equalTo(CGSizeMake(16.00*HEIGHT, 17.00*HEIGHT));
    }];
    UILabel *timeL = [[UILabel alloc]init];
    timeL.text = @"2016-01-02";
    timeL.textColor = ZITI;
    timeL.alpha = 0.6;
    timeL.font = [UIFont systemFontOfSize:13.00*WEIGHT];
    [self.myBackimageView addSubview:timeL];
    
    [timeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_nameL.mas_bottom).offset(15.00*HEIGHT/2);
        make.left.equalTo(timeIm.mas_right).offset(5.00*WEIGHT);
        make.size.mas_equalTo(CGSizeMake(75.00*WEIGHT, 15.00*HEIGHT));
        
    }];
    
    
    
    
    
    
    UIImageView *adressIM = [[UIImageView alloc]init];
    adressIM.image = [UIImage imageNamed:@"DIZHI2p-01-01.png"];
    [self.myBackimageView addSubview:adressIM];
    [adressIM mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_nameL.mas_bottom).offset(13.00*HEIGHT/2);
        make.left.equalTo(timeL.mas_right).offset(10.00*WEIGHT/2);
        make.size.mas_equalTo(CGSizeMake(16.00*HEIGHT, 17.00*HEIGHT));
    }];

    UILabel *addressL = [[UILabel alloc]init];
    addressL.text = @"齐齐哈尔";
    addressL.textColor = ZITI;
    addressL.alpha = 0.6;
    addressL.font = [UIFont systemFontOfSize:13.00*WEIGHT];
    [self.myBackimageView addSubview:addressL];
    [addressL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_nameL.mas_bottom).offset(15.00*HEIGHT/2);
        make.left.equalTo(adressIM.mas_right).offset(2.00*WEIGHT);
        make.size.mas_equalTo(CGSizeMake(55.00*WEIGHT, 15.00*HEIGHT));
        
    }];

    
    
    
    
    //随请求数据判断男女
    self.sexImageView = [UIImageView new];
    self.sexImageView.backgroundColor = [UIColor redColor];
    [self.myBackimageView addSubview:self.sexImageView];
    [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(addressL.mas_right).offset(6 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(16 *AUTO_WIDTH, 17 * AUTO_HEIGHT));
        make.top.mas_equalTo(_nameL.mas_bottom).offset(15.00*HEIGHT/2);
        
    }];
    
    self.sexL = [[UILabel alloc]init];
    //    addressL.backgroundColor = [UIColor redColor];
    self.sexL.text = @"女";
    self.sexL.textColor = HS;
    self.sexL.alpha = 0.6;
    self.sexL.font = [UIFont systemFontOfSize:13.00*WEIGHT];
    [self.myBackimageView addSubview:self.sexL];
    [self.sexL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_nameL.mas_bottom).offset(15.00*HEIGHT/2);
        make.left.equalTo(self.sexImageView.mas_right).offset(2.00*WEIGHT);
        make.size.mas_equalTo(CGSizeMake(20.00*WEIGHT, 15.00*HEIGHT));
        
    }];
    
    
    
    
    
    
    self.workIM = [[UIImageView alloc]init];
    
    self.workIM.image = [UIImage imageNamed:@"renshu-0140x40-01.png"];
    [self.myBackimageView addSubview:self.workIM];
    [self.workIM mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameL.mas_bottom).offset(13.00*HEIGHT/2);
        make.left.equalTo(self.sexL.mas_right).offset(10.00*WEIGHT/2);
        make.size.mas_equalTo(CGSizeMake(16.00*HEIGHT, 16.00*HEIGHT));
    }];
    
    self.workL = [[UILabel alloc]init];
    //        workL.backgroundColor = [UIColor redColor];
    self.workL.text = @"99人";
    self.workL.alpha = 0.6;
    self.workL.textColor = HS;
    self.workL.font = [UIFont systemFontOfSize:13.00*WEIGHT];
    [self.myBackimageView addSubview:self.workL];
    [self.workL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameL.mas_bottom).offset(15.00*HEIGHT/2);
        make.left.equalTo(self.workIM.mas_right).offset(7.00*WEIGHT);
        make.size.mas_equalTo(CGSizeMake(35.00*WEIGHT, 15.00*HEIGHT));
 
        
    }];
    
    
    
    
    
    
    UIImageView *peopleIM = [[UIImageView alloc]init];
    peopleIM.image = [UIImage imageNamed:@"jingyan3p-01-01.png"];
    [self.myBackimageView addSubview:peopleIM];
    [peopleIM mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(timeIm.mas_bottom).offset(16.00*HEIGHT/2);
        make.left.equalTo(timeIm);
        
        make.size.mas_equalTo(CGSizeMake(16.00*HEIGHT, 18.00*HEIGHT));
        

    }];
    
         self.peopleL= [[UILabel alloc]init];
    //    peopleL.backgroundColor = [UIColor redColor];
    self.peopleL.text = @"1-3年";
    self.peopleL.alpha =0.6;
    //self.peopleL.backgroundColor = [UIColor redColor];
    self.peopleL.textColor = HS;
    self.peopleL.font = [UIFont systemFontOfSize:13.00*WEIGHT];
    [self.myBackimageView addSubview:self.peopleL];
    [self.peopleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(peopleIM);
        make.left.equalTo(peopleIM.mas_right).mas_equalTo(5 * AUTO_WIDTH);
        
        make.size.mas_equalTo(CGSizeMake(40.00*HEIGHT, 18.00*HEIGHT));
        
    }];
    
    
    
    
    
    
    UIImageView *ageIM = [[UIImageView alloc]init];
    ageIM.image = [UIImage imageNamed:@"nianling40x40-01-01.png"];
    [self.myBackimageView addSubview:ageIM];
    [ageIM mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(peopleIM);
        make.left.equalTo(self.peopleL.mas_right).offset(10.00*WEIGHT/2);
        make.size.mas_equalTo(CGSizeMake(16.00*HEIGHT, 18.00*HEIGHT));
    }];
    
    self.ageL = [[UILabel alloc]init];
    //    peopleL.backgroundColor = [UIColor redColor];
    self.ageL.text = @"23岁";
    self.ageL.alpha = 0.6;
    self.ageL.textColor = HS;
    self.ageL.font = [UIFont systemFontOfSize:13.00*WEIGHT];
    [self.myBackimageView addSubview:self.ageL];
    [self.ageL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(timeIm.mas_bottom).offset(18.00*HEIGHT/2);
        make.left.equalTo(ageIM.mas_right).offset(4.00*WEIGHT);
        make.size.mas_equalTo(CGSizeMake(38.00*WEIGHT, 15.00*HEIGHT));
        
    }];
    
    
    
    
    
    
    
    
    UIImageView *heightIM = [[UIImageView alloc]init];
    
    heightIM.image = [UIImage imageNamed:@"12X27@2P-01.png"];
    [self.myBackimageView addSubview:heightIM];
    [heightIM mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(timeIm.mas_bottom).offset(16.00*HEIGHT/2);
        make.left.equalTo(_ageL.mas_right).offset(20.00*WEIGHT/2);
        make.size.mas_equalTo(CGSizeMake(10.00*HEIGHT, 17.00*HEIGHT));
    }];
    
    UILabel *heightL = [[UILabel alloc]init];
    //    peopleL.backgroundColor = [UIColor redColor];
    heightL.text = @"165cm-172cm";
    heightL.textColor = HS;
    heightL.alpha = 0.6;
    heightL.font = [UIFont systemFontOfSize:13.00*WEIGHT];
    [self.myBackimageView addSubview:heightL];
    [heightL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(timeIm.mas_bottom).offset(18.00*HEIGHT/2);
        make.left.equalTo(heightIM.mas_right).offset(4.00*WEIGHT);
        make.size.mas_equalTo(CGSizeMake(14.00*heightL.text.length, 15.00*HEIGHT));
       
        
    }];
    
    
    
    
    
//    
//    UIImageView *imageViewLin = [[UIImageView alloc]initWithFrame:CGRectMake(0, 300, 320, 20)];
//    imageViewLin.alpha = 0.2;
//    imageViewLin.backgroundColor = [UIColor clearColor];
//    //    [self.view addSubview:imageViewLin];
//    //    imageViewLin.backgroundColor = [UIColor redColor];
//    [self.contentView addSubview:imageViewLin];
//    [imageViewLin mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.top.equalTo(heightL.mas_bottom).offset(22.00*HEIGHT/2);
//        make.left.equalTo(self.contentView).offset(10.00*WEIGHT/2);
//        make.right.equalTo(self.contentView.mas_right).offset(-10.00*WEIGHT/2);
//        make.size.mas_equalTo(CGSizeMake(self.contentView.frame.size.width-10.00 * WEIGHT, 8.00*HEIGHT));
//    }];
    
//    UIGraphicsBeginImageContext(imageViewLin.frame.size);   //开始画线
//    [imageViewLin.image drawInRect:CGRectMake(0, 0, imageViewLin.frame.size.width, imageViewLin.frame.size.height)];
//    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);  //设置线条终点形状
//    
//    CGFloat lengths[] = {3,1};
//    
//    CGContextRef Xline = UIGraphicsGetCurrentContext();
//    CGContextSetStrokeColorWithColor(Xline, [UIColor blackColor].CGColor);
//    CGContextSetLineWidth(Xline, 0.9);
//    
//    CGContextSetLineDash(Xline, 0, lengths, 2);  //画虚线
//    CGContextMoveToPoint(Xline, 20, 8.00*HEIGHT);    //开始画线
//    CGContextAddLineToPoint(Xline, self.contentView.frame.size.width - 20, 8.00*HEIGHT);
//    CGContextStrokePath(Xline);
//    
//    imageViewLin.image = UIGraphicsGetImageFromCurrentImageContext();
//    
    
    

    
    
    
    
    
   }
- (void)awakeFromNib {
    // Initialization code
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
